import { App, Config, Inject, Middleware } from "@midwayjs/decorator";
import * as _ from "lodash";
import { NextFunction, Context } from "@midwayjs/koa";
import { IMiddleware, IMidwayApplication } from "@midwayjs/core";
import { CacheManager } from "@midwayjs/cache";

/**
 * 中间件
 */
@Middleware()
export class BaseAuthorityMiddleware
  implements IMiddleware<Context, NextFunction>
{
  @Config("koa.globalPrefix")
  prefix;

  @Config("module.base")
  jwtConfig;

  @Inject()
  cacheManager: CacheManager;

  @App()
  app: IMidwayApplication;

  resolve() {
    return async (ctx: Context, next: NextFunction) => {
      await next();
    };
  }
}
